import { Component } from "react";
class Count extends Component {
    constructor(props) {
        super(props);
        // 相当于vue里的Data
        this.state = {
            count: 0
        }
    }

    render() {
        // 父子组件传参
        // 父组件向子组件传参
        // 子组件通过this.props接手父组件传过来的参数
        console.log(this.props)
        const { title } = this.props;
        return (
            <div>
                <h3>heading</h3>
                {title}
                <button onClick={ ()=>{ this.handleClick() }
                }>count++ {this.state.count}</button>
            </div>
        )
    }

    handleClick() {
        console.log(this.state.count++)
        this.setState({
            conunt: ++this.state.count
        })

    }
}




export default Count

